import {effects} from 'redux-saga/dist/redux-saga.umd.min.js';
// import { delay } from 'redux-saga';
import restfulapi from './restfulapi';
// import fetchJsonp from 'fetch-jsonp'
// import { wsflow } from './api.ws.js';
const { put,call,takeEvery,takeLatest } = effects;
import { asyncAdd, asyncAdd_result } from '../actions';

// import { push,} from 'react-router-redux';
// import { Toast } from 'antd-mobile';
//获取豆瓣测试数据
export function* getDataList(){
    //
    yield takeLatest(`${asyncAdd}`, function*(action) {
        try{
            const { payload } = action;
            console.log("001");
            // const { apiurl } = payload;
            // const { query } = payload;
            // const {startDate,endDate} = query;

            const Data = yield call(restfulapi.getlist_saga_get,{...payload});
            
            console.log('002');
            console.log(Data);
            put(asyncAdd_result(Data.status));
            console.log(put(asyncAdd_result(Data.status)));
        }catch(e){
            console.log(e);
        }
    });

}
